package nc.impl.hrpbm.sjxm.sjxmh;

import java.util.Map;
import java.util.HashMap;
import java.util.Arrays;
import java.util.List;
import java.util.ArrayList;
import java.util.stream.Collectors;
import java.util.UUID;
import java.lang.String;
import java.util.stream.Stream;
import nc.vo.pub.lang.UFDateTime;
import nc.uap.utils.InSQLCreator;
import org.apache.commons.lang3.ArrayUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.beanutils.PropertyUtils;
import nc.vo.bd.meta.BDObjectAdpaterFactory;
import nc.vo.bd.meta.IBDObject;
import nc.vo.bd.meta.IBDObjectAdapterFactory;

import nc.vo.pub.BusinessException;
import nc.vo.pub.BusinessRuntimeException;
import nc.vo.pub.SuperVO;
import nc.vo.pub.VOStatus;
import nc.codeplatform.framework.service.ServiceSupport;

import nc.pub.billcode.vo.BillCodeContext;

import nc.vo.sjxm.sjxm.SjxmBVO;
import nc.vo.sjxm.sjxm.SjxmHVO;
import nc.vo.sjxm.sjxm.AggSjxmVO;
import nc.itf.hrpbm.sjxm.sjxmh.ISjxmHVOService;


import nc.vo.pub.pf.BillStatusEnum;
import nc.bs.framework.common.InvocationInfoProxy;
import nccloud.framework.core.exception.ExceptionUtils;

public class  SjxmHVOServiceImpl extends ServiceSupport implements ISjxmHVOService {

	public SjxmHVOServiceImpl() {
		super("1b9456d4-3152-488d-abda-e823d82fa9f3");
	}


	@Override
	public AggSjxmVO[] listAggSjxmVOByPk(String...pks) throws BusinessException{
		return listAggSjxmVOByPk(false,pks);
	}

	@Override
	public AggSjxmVO[] listAggSjxmVOByPk(boolean blazyLoad,String... pks) throws BusinessException{
		return dao.listByPksWithOrder(AggSjxmVO.class,pks,blazyLoad);
	}

	@Override
	public AggSjxmVO findAggSjxmVOByPk(String pk) throws BusinessException{
		return dao.findByPkWithDr(AggSjxmVO.class, pk, true);
	}

	@Override
	public  AggSjxmVO[] listAggSjxmVOByCondition(String condition) throws BusinessException{
		return listAggSjxmVOByCondition(condition,new String[]{"pk_sjxm"});
	}
	@Override
	public  AggSjxmVO[] listAggSjxmVOByCondition(String condition,String[] orderPath) throws BusinessException{
		return dao.listByCondition(AggSjxmVO.class, condition, false,false,orderPath);
	}
	@Override
	public SjxmHVO[] listSjxmHVOByPk(String... pks) throws BusinessException{
		return dao.listByPk(SjxmHVO.class, pks, true);
	}

	@Override
	public  SjxmHVO findSjxmHVOByPk(String pk) throws BusinessException{
		return dao.findByPk(SjxmHVO.class, pk, true);
	}

	@Override
	public  SjxmHVO[] listSjxmHVOByCondition(String condition) throws BusinessException{
		return listSjxmHVOByCondition(condition,new String[]{"pk_sjxm"});
	}
	@Override
	public  SjxmHVO[] listSjxmHVOByCondition(String condition,String[] orderPath) throws BusinessException{
		return dao.listByCondition(SjxmHVO.class, condition, false,false,orderPath);
	}

	@Override
	public String[] listSjxmHVOPkByCond(String condition) throws BusinessException{
		return listSjxmHVOPkByCond(condition,new String[]{"pk_sjxm"});
	}
	@Override
	public String[] listSjxmHVOPkByCond(String condition,String[] orderPath) throws BusinessException{
		if(StringUtils.isEmpty(condition)) {
			condition = " 1 = 1 ";
		}
		StringBuilder sql = new StringBuilder();
		sql.append(" select pk_sjxm from ").append(SjxmHVO.getDefaultTableName());
		sql.append(" where ").append(condition);
		if (ArrayUtils.isNotEmpty(orderPath)) {
			sql.append(" order by ").append(StringUtils.join(orderPath, ", "));
		}
		return (String[]) dao.getBaseDAO().executeQuery(sql.toString(), (rs) -> {
			List<String> pks = new ArrayList<>();
			while (rs.next()) {
				pks.add(rs.getString(1));
			}
			return pks.toArray(new String[0]);
		});
	}
	@Override
	public void initDefaultData(SjxmHVO vo){
		if(vo.getAttributeValue("pk_group") == null){
			vo.setAttributeValue("pk_group",InvocationInfoProxy.getInstance().getGroupId());
		}
		if(vo.getAttributeValue("billmaker") == null){
			vo.setAttributeValue("billmaker",InvocationInfoProxy.getInstance().getUserId());
		}
		if(vo.getAttributeValue("maketime") == null){
			vo.setAttributeValue("maketime",new UFDateTime(InvocationInfoProxy.getInstance().getBizDateTime()));
		}
		if(vo.getAttributeValue("creator") == null){
			vo.setAttributeValue("creator",InvocationInfoProxy.getInstance().getUserId());
		}
		if(vo.getAttributeValue("creationtime") == null){
			vo.setAttributeValue("creationtime",new UFDateTime(InvocationInfoProxy.getInstance().getBizDateTime()));
		}
		if(vo.getAttributeValue("billtype") == null){
			vo.setAttributeValue("billtype","SJXM");
		}
		if(vo.getAttributeValue("approvestatus") == null){
			vo.setAttributeValue("approvestatus",BillStatusEnum.FREE.toIntValue());
		}
	}
	@Override
	public AggSjxmVO preAddAggSjxmVO(AggSjxmVO vo,Map<String,Object> userJson) throws BusinessException{

		getMainVO(vo).setStatus(VOStatus.NEW);
		initDefaultData((SjxmHVO)getMainVO(vo));
		String pk_org = InvocationInfoProxy.getInstance().getGroupId();

		//下面这段要判断是否是树表界面插件
		Map<String,String> data = userJson!=null && userJson.get("data") != null?(Map<String,String>)userJson.get("data"):null;
		if(data!=null && data.size()>0){
			String parentKey = data.get("parentKey");
			String parentPk = data.get("parentPk");
			getMainVO(vo).setAttributeValue(parentKey,parentPk);
		}

		//编码规则生成vo的编码
		BillCodeContext billCodeContext = getBillCodeContext("sjxmsjxm");
		if(billCodeContext == null){
			throw new BusinessException("当前编码规则不存在，请到【编码规则定义-全局】节点检查是否存在"+"sjxmsjxm");
		}
		if(billCodeContext.isPrecode()){
			String pk_group = InvocationInfoProxy.getInstance().getGroupId();
			String code = getBillcodeManage().getPreBillCode_RequiresNew("sjxmsjxm", pk_group, pk_org);
			getMainVO(vo).setAttributeValue("hopbillcode",code);
		}

		return vo;
	}
	@Override
	public AggSjxmVO preAddAggSjxmVO(Map<String,Object> userJson) throws BusinessException{
		AggSjxmVO result = null;

		SjxmHVO mainvo = new SjxmHVO();
		//设置默认值
		initDefaultData(mainvo);

		AggSjxmVO aggvo = new AggSjxmVO();
		aggvo.setParent(mainvo);
		result = aggvo;
		return preAddAggSjxmVO(result,userJson);
	}

	@Override
	public AggSjxmVO preEditAggSjxmVO(String pk) throws BusinessException{
		return dao.findByPkWithDr(AggSjxmVO.class, pk, true);
	}
	@Override
	public AggSjxmVO copyAggSjxmVO(String pk) throws BusinessException{

		AggSjxmVO vo = dao.findByPkWithDr(AggSjxmVO.class, pk, false);

		if (vo == null) {
			throw new BusinessException("没有查到对应的数据，请重试");
		}

		getMainVO(vo).setPrimaryKey(null);
		getMainVO(vo).setStatus(VOStatus.NEW);

		getMainVO(vo).setAttributeValue("srcbilltype",null);
		getMainVO(vo).setAttributeValue("srcbillid",null);

		getMainVO(vo).setAttributeValue("hopbillcode",null);
		getMainVO(vo).setAttributeValue("name",null);
		String defaultGroup = InvocationInfoProxy.getInstance().getGroupId();
		getMainVO(vo).setAttributeValue("pk_group.pk_group",defaultGroup);
		String pk_org = InvocationInfoProxy.getInstance().getGroupId();
		if(getMainVO(vo).getAttributeValue("pk_org.pk_org") != null){
			pk_org = (String)getMainVO(vo).getAttributeValue("pk_org.pk_org");
		}
		//编码规则生成vo的编码
		BillCodeContext billCodeContext = getBillCodeContext("sjxmsjxm",InvocationInfoProxy.getInstance().getGroupId(),pk_org);
		if(billCodeContext == null){
			throw new BusinessException("当前编码规则不存在，请到【编码规则定义-全局】节点检查是否存在"+"sjxmsjxm");
		}
		if(billCodeContext.isPrecode()){
			String pk_group = InvocationInfoProxy.getInstance().getGroupId();
			String code = getBillcodeManage().getPreBillCode_RequiresNew("sjxmsjxm", pk_group, pk_group);
			getMainVO(vo).setAttributeValue("hopbillcode",code);
		}
		getMainVO(vo).setAttributeValue("approvestatus", BillStatusEnum.FREE.toIntValue());
		getMainVO(vo).setAttributeValue("billmaker", InvocationInfoProxy.getInstance().getUserId());
		getMainVO(vo).setAttributeValue("approver", null);
		getMainVO(vo).setAttributeValue("approvenote", null);
		getMainVO(vo).setAttributeValue("approvedate", null);
		//设置审计信息为空
		getMainVO(vo).setAttributeValue("creator",null);
		getMainVO(vo).setAttributeValue("creationtime",null);
		getMainVO(vo).setAttributeValue("modifier",null);
		getMainVO(vo).setAttributeValue("lastmaketime",null);
		getMainVO(vo).setAttributeValue("maketime", new UFDateTime(InvocationInfoProxy.getInstance().getBizDateTime()));
		getMainVO(vo).setAttributeValue("lastmaketime", null);

		SjxmBVO[] sjxmBVOs = (SjxmBVO[])vo.getChildren(SjxmBVO.class);
		if(sjxmBVOs!=null && sjxmBVOs.length>0){
			Arrays.stream(sjxmBVOs).forEach(subvo->{
				subvo.setPrimaryKey(null);
				subvo.setStatus(VOStatus.NEW);
				subvo.setAttributeValue("srcbilltype",null);
				subvo.setAttributeValue("srcbillid",null);
				subvo.setAttributeValue("rowno", null);
				subvo.setAttributeValue("srcrowno", null);
			});
		}
		return vo;
	}

	public AggSjxmVO[] saveAggSjxmVO(AggSjxmVO vo ) throws BusinessException{
		return this.saveAggSjxmVO(vo, null);
	}

	public AggSjxmVO[] saveAggSjxmVO(AggSjxmVO vo , String nodetype ) throws BusinessException{
        lockUtils.lock(vo);
		String pk = getVOPrimaryKey(vo);
		setDefaultVal(vo);
		if(StringUtils.isEmpty(pk)){
			return insert(vo); //插入
		}else{
			return update(vo); //更新
		}
	}

	/**
	 * 保存前处理编码规则
	 * @param vos
	 */
	private void setBillCode(AggSjxmVO... vos) throws BusinessException {
		if (ArrayUtils.isEmpty(vos)) {
			return;
		}
		for(AggSjxmVO vo : vos) {
			String pk = getVOPrimaryKey(vo);
			if (StringUtils.isNotEmpty(pk)) {
				continue;
			}
			String pk_group = InvocationInfoProxy.getInstance().getGroupId();
			String pk_org = pk_group;
			if (getMainVO(vo).getAttributeValue("pk_org.pk_org") != null){
				pk_org = (String)getMainVO(vo).getAttributeValue("pk_org.pk_org");
			}
			BillCodeContext billCodeContext = getBillCodeContext("sjxmsjxm", pk_group, pk_org);
			if (billCodeContext == null) {
				throw new BusinessException("当前编码规则不存在，请到【编码规则定义-全局】节点检查是否存在"+"sjxmsjxm");
			}
			if (billCodeContext.isPrecode()) {
				String code = (String) getMainVO(vo).getAttributeValue("hopbillcode");
				getBillcodeManage().commitPreBillCode("sjxmsjxm", pk_group, pk_org, code);
			} else {
				if(getMainVO(vo).getAttributeValue("hopbillcode") == null){
					String code = getBillcodeManage().getBillCode_RequiresNew("sjxmsjxm", pk_group, pk_org,vo);
					getMainVO(vo).setAttributeValue("hopbillcode",code);
				}
			}
		}
	}
	/**
	 * 保存前设置审计信息
	 * @param vos
	 */
	private void setAuditInfo(AggSjxmVO... vos) throws BusinessException {
		if(ArrayUtils.isNotEmpty(vos)) {
			UFDateTime now = new UFDateTime();
			for(AggSjxmVO vo : vos) {
				String pk = getVOPrimaryKey(vo);
				if(StringUtils.isEmpty(pk)){
					//设置创建人创建时间
					getMainVO(vo).setAttributeValue("creator",InvocationInfoProxy.getInstance().getUserId());
					getMainVO(vo).setAttributeValue("creationtime",now);
					getMainVO(vo).setAttributeValue("maketime",now);
					getMainVO(vo).setAttributeValue("billmaker", InvocationInfoProxy.getInstance().getUserId()); // 制单人
					getMainVO(vo).setAttributeValue("modifier",null);
					getMainVO(vo).setAttributeValue("lastmaketime",null);
				}else{
					//设置修改人修改时间
					getMainVO(vo).setAttributeValue("modifier",InvocationInfoProxy.getInstance().getUserId());
					getMainVO(vo).setAttributeValue("lastmaketime",now);
					getMainVO(vo).setAttributeValue("lastmaketime",now);
				}
			}
		}
	}
	/**
	 * 保存前处理一些默认值
	 * @param vos
	 */
	private void setDefaultVal(AggSjxmVO... vos) throws BusinessException {
		setBillCode(vos);
		setAuditInfo(vos);
		//其他默认值处理
	}

	// 给单表（行编辑表）单独适配
	@Override
	public AggSjxmVO[] saveAggSjxmVO(AggSjxmVO[] vos) throws BusinessException {
		return this.saveAggSjxmVO(vos, null);
	}

	public AggSjxmVO[] saveAggSjxmVO(AggSjxmVO[] vos , String nodetype ) throws BusinessException {
		if (ArrayUtils.isEmpty(vos)) {
			return new AggSjxmVO[0];
		}
        lockUtils.lock(vos);
		setDefaultVal(vos); // 设置默认值
		List<String> pks = Arrays.stream(vos).filter(v -> getMainVO(v).getStatus() == VOStatus.DELETED)
				.map(v -> getMainVO(v).getPrimaryKey()).collect(Collectors.toList()); // 删除单据主键
		if (pks == null || pks.size() == 0) {
			return save(vos, true);
		}
		AggSjxmVO[] deleteVOs = dao.listByPk(AggSjxmVO.class, pks.toArray(new String[0]));
		if (deleteVOs == null || deleteVOs.length == 0) {
			return save(vos, true);
		}
		for (int i = 0; i < deleteVOs.length; i++) {
			SuperVO mainVO = getMainVO(deleteVOs[i]);
			// 删除单据时校验单据状态
			Integer approveStatus = (Integer) mainVO.getAttributeValue("approvestatus");
			if (approveStatus != null && !approveStatus.equals(-1)) {
				throw new BusinessException("第" + (i + 1) + "张单据处理失败：单据状态不正确，不能删除！");
			}
			// 删除单据时回退单据号
			String code = (String)mainVO.getAttributeValue("hopbillcode");
			if (StringUtils.isNotEmpty(code)) {
				String pk_group = InvocationInfoProxy.getInstance().getGroupId();
				getBillcodeManage().returnBillCodeOnDelete("sjxmsjxm", pk_group, pk_group, code, deleteVOs[i]);
			}
		}
		return save(vos,true);
	}

	@Override
	public AggSjxmVO[] deleteAggSjxmVOs(Map<String,String> tsMap) throws BusinessException{
		 return deleteAggSjxmVOs(tsMap, null);
	}
	@Override
	public AggSjxmVO[] deleteAggSjxmVOs(Map<String,String> tsMap, String nodetype) throws BusinessException{
		AggSjxmVO[] vos = dao.listByPk(AggSjxmVO.class,tsMap.keySet().toArray(new String[0]));
		if (vos == null || vos.length == 0) {
			throw new BusinessException("没有查到对应的数据，请重试");
		}

		lockUtils.lock(vos);
		validate(vos,tsMap);
		
		String pk_group = InvocationInfoProxy.getInstance().getGroupId();
		Arrays.stream(vos).forEach(vo->{
			String code = (String)getMainVO(vo).getAttributeValue("hopbillcode");
			try {
				getBillcodeManage().returnBillCodeOnDelete("sjxmsjxm",pk_group,pk_group,code,vo);
			} catch (BusinessException e) {
				ExceptionUtils.wrapException(e.getMessage(),e);
			}
		});
		delete(vos,true);
        
		return vos;
	}

	//校验  包括ts校验  已提交校验
	private void validate(AggSjxmVO[] vos,Map<String,String> tsMap) throws BusinessException{

		Boolean isPass = true;
		String error = "";    //错误信息
		if(ArrayUtils.isEmpty(vos)){
			isPass = false;
		}

		for(int i = 0 ; i < vos.length ; i++){
			SuperVO mainvo = vos[i].getParentVO();
			UFDateTime ts = (UFDateTime)mainvo.getAttributeValue("ts");
			if(!StringUtils.equals(tsMap.get(mainvo.getPrimaryKey()),ts.toString())){
				isPass = false;
				break;
			}
			Integer approvestatus = (Integer) mainvo.getAttributeValue("approvestatus");
			if(approvestatus == null || approvestatus != BillStatusEnum.FREE.toIntValue()){
				error += "第"+(i+1)+"张单据处理失败：审批状态不正确，不能删除！\n";
			}
		}
		if(!isPass) {
			throw new BusinessException("您操作的数据已被他人修改或删除，请刷新后重试！");
		}
		if(!"".equals(error)){
			throw new BusinessException(error);
		}
	}

	@Override
	public <T> T[] loadTreeData(Class<T> clazz,Map<String,Object> userJson) throws BusinessException{
		String condition = "dr = 0 ";
		if(userJson.get("pk_transtype")!=null){
			String pk_transtype = (String)userJson.get("pk_transtype");
			if(!StringUtils.isEmpty(pk_transtype)){
				condition += " and transtypepk='"+pk_transtype+"'";
			}
		}

		return dao.listByCondition(clazz, condition, false);
	}

	@Override
	public String[] queryChildPksByParentId(Class childClazz, String parentId) throws BusinessException{
		String cond = " pk_sjxm = '" + parentId + "' ";
		SuperVO[] vos  = (SuperVO[]) dao.listByCondition(childClazz, cond, false);
		if (vos == null || vos.length == 0) {
			return new String[0];
		}
		return Stream.of(vos).map(vo -> vo.getPrimaryKey()).toArray(String[]::new);
	}


	public SuperVO[] queryChildVOByPks(Class childClazz, String[] pks) throws BusinessException{
		return (SuperVO[]) dao.listByPk(childClazz, pks, false);
	}

	/**
	 * 提交前校验:
	 * 检查单据状态
	 * @throws BusinessException
	 * */
	private void validateCommitAggSjxmVO(AggSjxmVO... vos) throws BusinessException {
		if(ArrayUtils.isEmpty(vos)) {
			return ;
		}
		List<AggSjxmVO> list = Arrays.stream(vos)
			.filter(item ->item.getParentVO()!=null)
			.filter(item->{
				Integer status =  (Integer) item.getParentVO().getAttributeValue("approvestatus");
				return status==null||status!=BillStatusEnum.FREE.toIntValue()&&status!=BillStatusEnum.NOPASS.toIntValue();
			}).map(item->item)
			.collect(Collectors.toList());
		if(list == null||list.size() == 0) {
			return;
		}
		String errors = "";
		for(AggSjxmVO vo  : list) {
			errors+="单据号：["+vo.getParentVO().getAttributeValue("hopbillcode")+"]提交失败，失败原因：单据状态不正确，请检查。\n";
		}
		throw new BusinessException(errors);
	}
	/**
	 * 收回前校验:
	 * 检查单据状态
	 * @throws BusinessException
	 * */
	private void validateUnCommitAggSjxmVO(AggSjxmVO... vos) throws BusinessException {
		if(ArrayUtils.isEmpty(vos)) {
			return ;
		}
		List<AggSjxmVO> list = Arrays.stream(vos)
			.filter(item ->item.getParentVO()!=null)
			.filter(item->{
				Integer status =  (Integer)item.getParentVO().getAttributeValue("approvestatus");
				return status==null||status==BillStatusEnum.FREE.toIntValue();
			}).map(item->item)
			.collect(Collectors.toList());
		if(list == null||list.size() == 0) {
			return;
		}
		String errors = "";
		for(AggSjxmVO vo  : list) {
			errors+="单据号：["+vo.getParentVO().getAttributeValue("hopbillcode")+"]收回失败，失败原因：单据状态不正确，请检查。\n";
		}
		throw new BusinessException(errors);
	}
	@Override
	public Object commitAggSjxmVO(String actionName,Map<String,String> tsMap,Object assign) throws BusinessException{
		AggSjxmVO[] vos = dao.listByPk(AggSjxmVO.class,getAllPks(tsMap),false);
		validateTs(tsMap,vos);
		//提交前校验及业务逻辑
		validateCommitAggSjxmVO(vos);
		Map<String,Object> res = this.execFlows(actionName,"SJXM",assign,vos);
		//提交后业务逻辑
		return res;
	}

	@Override
	public Object batchCommitAggSjxmVO(String actionName,Map<String,String> tsMap) throws BusinessException{
		AggSjxmVO[] vos = dao.listByPk(AggSjxmVO.class,getAllPks(tsMap),false);
		validateTs(tsMap,vos);
		//批量提交前校验及业务逻辑
		validateCommitAggSjxmVO(vos);
		Map<String,Object> res = this.execFlows(actionName,"SJXM",vos);
		//批量提交后业务逻辑
		return res;
	}

	@Override
	public Object uncommitAggSjxmVO(String actionName,Map<String,String> tsMap) throws BusinessException{
		AggSjxmVO[] vos = dao.listByPk(AggSjxmVO.class,getAllPks(tsMap),false);
		validateTs(tsMap,vos);
		//收回前校验及业务逻辑
		validateUnCommitAggSjxmVO(vos);
		Map<String,Object> res = this.execFlows(actionName,"SJXM",vos);
		//收回后业务逻辑
		return res;
	}

	@Override
	public Object batchUncommitAggSjxmVO(String actionName,Map<String,String> tsMap) throws BusinessException{
		AggSjxmVO[] vos = dao.listByPk(AggSjxmVO.class,getAllPks(tsMap),false);
		validateTs(tsMap,vos);
		//批量收回前校验及业务逻辑
		validateUnCommitAggSjxmVO(vos);
		Map<String,Object> res = this.execFlows(actionName,"SJXM",vos);
		//批量收回后业务逻辑
		return res;
	}


	@Override
	public AggSjxmVO[] callbackSAVE(AggSjxmVO...vos) throws BusinessException{
		if(ArrayUtils.isEmpty(vos)) {
			return null;
		}
		//同步单据状态和审批状态(只有提交时候需要手动设置审批状态。其余审批完后审批状态都已更新)
		Arrays.stream(vos).forEach(v->{
				v.getParent().setAttributeValue("approvestatus",BillStatusEnum.COMMIT.toIntValue());
		});
		vos = this.saveAggSjxmVO(vos);
		return vos;

	}


	@Override
	public AggSjxmVO[] callbackUNSAVE(AggSjxmVO...vos) throws BusinessException{
		if(ArrayUtils.isEmpty(vos)) {
			return null;
		}
		vos = this.saveAggSjxmVO(vos);
		return vos;

	}


	@Override
	public AggSjxmVO[] callbackAPPROVE(AggSjxmVO...vos) throws BusinessException{
		if(ArrayUtils.isEmpty(vos)) {
			return null;
		}
		vos = this.saveAggSjxmVO(vos);
		return vos;

	}


	@Override
	public AggSjxmVO[] callbackSAVEBASE(AggSjxmVO...vos) throws BusinessException{
		if(ArrayUtils.isEmpty(vos)) {
			return null;
		}
		vos = this.saveAggSjxmVO(vos);
		return vos;

	}


	@Override
	public AggSjxmVO[] callbackUNAPPROVE(AggSjxmVO...vos) throws BusinessException{
		if(ArrayUtils.isEmpty(vos)) {
			return null;
		}
		vos = this.saveAggSjxmVO(vos);
		return vos;

	}


	@Override
	public BillCodeContext getBillCodeContext(String coderuleid) throws BusinessException{
		return super.getBillCodeContext(coderuleid);
	}

	@Override
	public BillCodeContext getBillCodeContext(String coderuleid, String pkgroup, String pkorg) throws BusinessException{
		return super.getBillCodeContext(coderuleid,pkgroup,pkorg);
	}

}
